{include file="public/header"}
<div class="main">
	<div class="public_pa">网站流量限制配置</div>

	<div id="main">
		<table class="table table-bordered">
			<thead>
				<tr>
					<th colspan="2">状态：{$netInfo.status ? '<span style="color:green">已开启</span><a href="?speed=off">[关闭]</a>' : '<span style="color:#2288cc">未开启</span>'}</th>
				</tr>
			</thead>
			<tbody>
			</tbody>
		</table>
		<form action="" method="post">
			<table class="table">
				<thead>
					<tr>
						<th style="border:0" colspan="2">限速设置</th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td>
							限制方案：<select class="bt-input-text mr5 limit" name="limit" style="width:160px"><option value="1">论坛/博客</option><option value="2">图片站</option><option value="3">下载站</option><option value="4">商城</option><option value="5">门户</option><option value="6">企业</option><option value="7">视频</option></select>
						</td>
						
					</tr>
					<tr>
						<td style="border:0">
							并发限制：<input name="perserver" class="span3" value="{$netInfo.perserver}" style="width:100px;">
						</td>
					</tr>
					<tr>
						<td style="border:0">
							单IP限制：<input name="perip" class="span3" value="{$netInfo.perip}" style="width:100px;">
						</td>
					</tr>
					<tr>
						<td style="border:0">
							流量限制：<input name="limit_rate" class="span3" value="{$netInfo.limit_rate}" style="width:100px;">
						</td>
					</tr>
					<tr>
						<td><input type="submit" value="保存并开启" class="btn btn-warning"></td>
					</tr>
				</tbody>
			</table>
		</form>
	</div>
</div>
{include file="public/footer"}
</div>
<script type="text/javascript">
	$("select[name='limit']").change(function(){
		var type = $(this).val();
		switch(type){
			case '1':
			perserver = 300;
			perip = 25;
			limit_rate = 512;
			break;
			case '2':
			perserver = 200;
			perip = 10;
			limit_rate = 1024;
			break;
			case '3':
			perserver = 50;
			perip = 3;
			limit_rate = 2048;
			break;
			case '4':
			perserver = 500;
			perip = 10;
			limit_rate = 2048;
			break;
			case '5':
			perserver = 400;
			perip = 15;
			limit_rate = 1024;
			break;
			case '6':
			perserver = 60;
			perip = 10;
			limit_rate = 512;
			break;
			case '7':
			perserver = 150;
			perip = 4;
			limit_rate = 1024;
			break;
		}

		$("input[name='perserver']").val(perserver);
		$("input[name='perip']").val(perip);
		$("input[name='limit_rate']").val(limit_rate);
		
	});
</script>
</body>
</html>